package com.jlz.actions.aboutus;

import java.util.Set;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Standard;

import com.julewa.loading.StrutsConfig;
import com.opensymphony.xwork2.config.entities.ActionConfig;

@Standard
public class IndexAction {
	
	public String execute(){
		return "home";
	}
	
	@Action("agreement")
	public String agreement(){
		return "agreement";
	}

	StringBuffer confs = new StringBuffer();
	public String getConf(){
		return confs.toString();
	}
	
	@SuppressWarnings("unchecked")
	@Action("actions")
	public String actions(){
		StrutsConfig conf = new StrutsConfig();
		Set<String> set = conf.getNamespaces();
		for(String ns: set){
			confs.append("<hr>").append(ns).append("<br>");
			Set<String> as = conf.getActionNames(ns);
			for(String a:as){
				confs.append("<span class='label'>").append(a).append("</span>:<span class='value'>");
				ActionConfig c = conf.getActionConfig(ns, a);
				confs.append(c.getClassName()).append("</span><br/>");
			}
		}
		
		return "actions";
	}
	
}
